var Url = "https://program.chinlingcloud.com/index.php/api/v2/";
    var url_id = getUrlParam("id");
    getOrderDetails(url_id);

    function getOrderDetails(id) {
        $.ajax({
            type: "get",
            url: Url + "order/" + id,
            async: false,
            timeout : 20000,
            beforeSend: function (xhr) {
                showDiv()
            },
            success: function (data) {
                hiddenDiv()
                console.log(data)
                setOrderDetails(data)
            },
            error: function (request, status, err) {
                failure(status)
            }
        });
    }

    function setOrderDetails(data) {
        $(".otn-time").append(data.createtime);
        $(".otn-num").append(data.order_number);
        var status = '';
        if (data.order_states == 1) {
            status = '未付款';
        } else if (data.order_states == 2) {
            status = '已付款';
        } else if (data.order_states == 3) {
            status = '已发货';
        } else if (data.order_states == 5) {
            status = '订单已取消';
        } else if (data.order_states == 6) {
            status = '待评价';
        } else if (data.order_states == 7) {
            status = '订单已完成';
        }
        $(".greater").text(status);
        var str = '';
        for (var i = 0; i < data.snap_items.length; i++) {
            var str1 = '';
            for (var k in data.snap_items[i].speci_snap) {
                str1 += '<div class="orderDetails-main-varieties">'
                    + k + ':' + data.snap_items[i].speci_snap[k] + '</div>'
            }
            str += '<div  class="orderDetails-main clear">' +
                '<img  class="orderDetails-main-img" src="' + data.snap_items[i].main_img_url + '"/>' +
                '<div class="orderDetails-main-title">' +
                '<div class="orderDetails-main-title-t clear">' +
                '<span class="cmt-name">' + data.snap_name + '</span>' +
                '<span class="cmt-num">x ' + data.snap_items[i].counts + '</span>' +
                '</div>' + str1 +
                '<div class="orderDetails-main-price">' +
                '￥' + data.snap_items[i].totalPrice +
                '</div>' +
                '</div>' +
                '</div>'
        }
        $(".orderDetails-goods").append(str);
        $(".o-i-a-name").text(data.snap_address.uaddres_name)
        $(".o-i-a-num").text(data.snap_address.uaddres_mobile)
        $(".o-i-a-add").text(data.snap_address.uaddres_province + data.snap_address.uaddres_city + data.snap_address.uaddres_county + data.snap_address.uaddres_detail)
        $(".o-i-s-total").children(".o-i-s-r").text("￥" + data.total_price)
        $(".o-i-p-r").text("￥" + data.total_price)
    }
    var imgSrc="/static/index/img/erweima_1.jpg"
    $(".online-contact").on("click",function(){
        mask(imgSrc)
    })



